<?php

/**
 * @deprecated Pouzi triedu Db_DbTable_*
 * 
 * ProfessorCommission
 *  
 * @author Radovan Dvorsky
 * @version 
 */

require_once 'Zend/Db/Table/Abstract.php';

class Db_ProfessorCommission extends Zend_Db_Table_Abstract {
	
	/**
	 * Primary keys	 
	 */
	protected $_primary = array('pid','cid');
	
	/**
	 * The default table name 
	 */
	protected $_name = 'professor_commission';	
		
	/**
	 * Parrent tables description 
	 */	
	protected $_referenceMap = array(
		'Professor' => array(
			'columns' => array('pid'),
			'refTableClass' => 'Db_Professor',
			'refColumns' => array('pid'),
			'onDelete' => self::CASCADE,	
		),
		'Commission' => array(
			'columns' => array('cid'),
			'refTableClass' => 'Db_Commission',
			'refColumns' => array('cid'),
			'onDelete' => self::CASCADE,	
		)
	);
	

	/**
	 * Pridá profesora do komisie	 
	 * 
	 * $data format:
	 * array(
	 * 		cid = int [commission_id],
	 * 		pid = int [professor_id]	
	 * )
	 * 
	 * @param array $data
	 * @return bool || Db_Exception
	 */
	public function addMember(array $data){
		try{
			
			$this->insert($data);
						
		} catch (Zend_Db_Exception $e){
			
			throw new Db_Exception($e->getMessage());
			
		}		
	}
}